package physics;

import java.util.ArrayList;
import java.util.List;

public class ActorList extends ArrayList<Actor> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * Get a list of all the Actors from the given class, in this list.
	 * @param 	c
	 * 				The of the actors you seek.
	 * @return	A list of actors from the given class.
	 */
	@SuppressWarnings("unchecked")
	public <E> List<E> getActors(Class<E> c){
		ArrayList<E> result = new ArrayList<E>();
		for (Actor a : this){
			if (c.isInstance(a))
				result.add((E) a);
		}
		return result;
	}

}
